<%--
  Created by IntelliJ IDEA.
  User: Hasee
  Date: 2019/11/26
  Time: 15:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="css/index1.css">
</head>
<body>
<div class="box">
    <p>上传log</p>
    <p>
    <div class="upload imgLog">
        <span><i class="glyphicon glyphicon-open"></i>上传log0</span>		</div>
    </p>
    <p>上传头像</p>
    <p>
    <div class="upload imgLog2">
        <span><i class="glyphicon glyphicon-open"></i>上传头像</span>	  </div>
    </p>
    <p>上传海报</p>
    <p>
    <div class="upload imgLog3">
        <span><i class="glyphicon glyphicon-open"></i>上传海报</span>	  </div>
    </p>
</div>
<script src="js/index.js"></script>
<script>
    $(function(){
        var img1 = new ImgUpload('.imgLog',210,55,55);
        var img2 = new ImgUpload('.imgLog2',100,100,100);
        var img3 = new ImgUpload('.imgLog3',400,200,200);

        $(document).on('change',".imgLog input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(images/e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')
            console.log(window.URL.createObjectURL(images/e.target.files[0]))

            img1.setSpan(this)
        })

        $(document).on('change',".imgLog2 input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(images/e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')
            img2.setSpan(this)
        })

        $(document).on('change',".imgLog3 input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(images/e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')

            img3.setSpan(this)
        })

    })

</script>
</body>
</html>
